<template>
  <div class="trainOrder">
    <div style="margin:0 0 20px 0">会员卡号：{{customernumber.customerCard}}</div>
    <el-button style="margin:0 0 10px 95%" type="primary" size="mini" @click="returntop">返回</el-button>
    <div class="table">
      <el-table size="mini" :header-cell-style="{
          color: '#fff',
          background: '#6090EC',
          fontSize: '11px',
          fontWeight: 'normal',
        }" :data="dataList" border>
        <el-table-column prop="ordernumber" label="订单号"> </el-table-column>
        <el-table-column prop="trainOrderItem[0].guestname" label="乘客姓名">
        </el-table-column>
        <el-table-column width="100px" prop="sumamount" label="票面价">
        </el-table-column>
        <el-table-column width="100px" prop="payAmount" label="总价  ">
        </el-table-column>
        <el-table-column width="100px" prop="traveldate" label="乘车日期">
        </el-table-column>
        <el-table-column width="100px" prop="departuretime" label="发车">
        </el-table-column>
        <el-table-column width="100px" prop="chooesseats" label="座位号">
        </el-table-column>
        <el-table-column width="130px" prop="departurestationname" label="出发车站">
        </el-table-column>
        <el-table-column width="150px" prop="arrivalstationname" label="到达车站">
        </el-table-column>
        <el-table-column width="130px" prop="status" label="订单状态">
          <template slot-scope="scope">
            <template v-if="scope.row.status == 'unpaid'">未支付</template>
            <template v-if="scope.row.status == 'payments'">支付中</template>
            <template v-if="scope.row.status == 'payd'"> 支付成功</template>
            <template v-if="scope.row.status == 'ticketing'">出票成功</template>
            <template v-if="scope.row.status == 'refundTicketSuccess'">退票成功</template>
            <template v-if="scope.row.status == 'cancelOrder'">取消订单</template>
            <template v-if="scope.row.status == 'changeTicket'">改签中</template>
            <template v-if="scope.row.status == 'changeTicketSuccess'">改签成功</template>
            <template v-if="scope.row.status == 'changeTicketFail'">改签失败</template>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
<script>
  export default {
    name: "trainOrder",
    data() {
      return {
        dataList: [],
        phone: "",
        customerId: "",
        customernumber: {},
        currentPage: '',
        pageSize: '',
      };
    },
    methods: {
      // 返回
      returntop() {
        this.$router.go(-1)
      },
      // 会员卡号
      getinformation() {
        this.$axios.getinformation({
          id: this.customerId,
        }).then((res) => {
          console.log(res)
          this.customernumber = res.data
          if (res.code == 200) {
            this.gettrainOrder()
          }
        })
      },
      //订单列表接口
      gettrainOrder() {
        localStorage.setItem("pageNum", this.currentPage);
        localStorage.setItem("pageSize", this.pageSize);
        this.$axios
          .gettrainOrder({
            customerCard: '',
            customerName: '',
            guestName: '',
            orderNumber: '',
            linkPhone: this.customernumber.customerPhone,
            trainNumber: '',
            status: '',
            orderPartnerNumber: '',
            ticketNumber: '',
            sourceAppId: '',
            createTime: '',
            endCreateTime: '',
          })
          .then((res) => {
            console.log(res);
            if (res.code == "200") {
              this.dataList = res.data;
              console.log(this.dataList)
            }
          });
      },



    },
    mounted() {
      this.customerId = this.$route.params.customerId;
      this.getinformation()
    },
  };
</script>

<style scoped>
  .trainOrder {
    margin: 20px;
  }
</style>